#!/usr/bin/python
# -*- coding: utf-8 -*-
# """
# Created on Fri May 26 15:11:15 2017
#
# @author: Justin
# """

import json
from numpy import *
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.lines as Line2D


def load():
    with open('sampleGenerated.json') as json_file:
        data = json.load(json_file)
        return data


data = load()
sampleCount = len(data)

full_data = []
for i in arange(sampleCount):
    data2 = data["samples"][i]
    full_data.extend(data2["data"])

row_count = len(full_data)
maxValue = max(max(full_data))
f1 = plt.figure(figsize=(16, 8))
x = arange(3000)
y = [[376, 382], [389, 416], [418, 426], [430, 562], [564, 569],
     [577, 605], [610, 616]];

for row in arange(row_count):
    ax = plt.subplot(row_count, 1, row + 1)
    ax.scatter(x, full_data[row], color='k', s=10, alpha=0.4)
    ax.axvline(400, color='r', linewidth=2, alpha=0.4)
    ax.axvline(600, color='r', linewidth=2, alpha=0.4)
    for yy in y:
        ax.axvspan(yy[0], yy[1], facecolor='b', alpha=0.3)

plt.show()